Skip to content

feat: add MiniMax as first-class LLM provider#190

Open
octo-patch wants to merge 1 commit intoplexe-ai:mainfrom
octo-patch:feature/add-minimax-provider
Open

feat: add MiniMax as first-class LLM provider#190
octo-patch wants to merge 1 commit intoplexe-ai:mainfrom
octo-patch:feature/add-minimax-provider

Conversation

@octo-patch
Copy link
Copy Markdown

Summary

This PR adds first-class support for MiniMax as an LLM provider in plexe, enabling users to route any agent to MiniMax models via the minimax/ prefix with zero-config auto-routing.

What's Changed

  • plexe/config.py: Added MINIMAX_API_BASE, MINIMAX_MODELS constants and auto-routing logic in get_routing_for_model() — when a model ID starts with minimax/, it auto-routes to https://api.minimax.io/v1 with the MINIMAX_API_KEY env var
  • plexe/utils/litellm_wrapper.py: Rewrites minimax/ prefix → openai/ for LiteLLM compatibility, clamps temperature to MiniMax's [0, 1.0] range
  • config.yaml.template: Added MiniMax configuration examples with available models
  • README.md: Documented MiniMax as a supported provider with setup guide in the Multi-Provider LLM Support section

Usage

export MINIMAX_API_KEY=<your-key>
# config.yaml
hypothesiser_llm: "minimax/MiniMax-M2.7"
planner_llm: "minimax/MiniMax-M2.7"
model_definer_llm: "minimax/MiniMax-M2.5-highspeed"
litellm_drop_params: true

Available models: MiniMax-M2.7, MiniMax-M2.7-highspeed (1M context), MiniMax-M2.5, MiniMax-M2.5-highspeed (204K context).

Design Decisions

  • Explicit routing config takes priority: If a user maps minimax/MiniMax-M2.7 to a custom provider in routing_config.models, that mapping is used instead of auto-routing
  • No changes to agent code: All 14 agents work with MiniMax automatically through the existing get_routing_for_model()PlexeLiteLLMModel pipeline
  • Temperature clamping: MiniMax supports [0, 1.0] temperature range; values outside this range are clamped automatically

Test Plan

  • 10 unit tests for model ID rewriting and temperature clamping (tests/unit/utils/test_litellm_wrapper.py)
  • 10 unit tests for MiniMax auto-routing, config loading, and explicit mapping override (tests/unit/test_config.py)
  • 3 integration tests for YAML config roundtrip, mixed provider config, and MiniMax API completion (tests/unit/test_minimax_integration.py)
  • All 5 existing config tests continue to pass

7 files changed, 413 additions

Add first-class support for MiniMax models via the minimax/ prefix.
Users can now configure agents to use MiniMax models (M2.7, M2.5, etc.)
with zero-config auto-routing - just set MINIMAX_API_KEY and use model
IDs like "minimax/MiniMax-M2.7".

Changes:
- config.py: Add MINIMAX_API_BASE, MINIMAX_MODELS constants and
  minimax/ prefix auto-routing in get_routing_for_model()
- litellm_wrapper.py: Rewrite minimax/ prefix to openai/ for LiteLLM
  compatibility, add temperature clamping for MiniMax [0, 1.0]
- config.yaml.template: Add MiniMax configuration examples
- README.md: Document MiniMax as supported provider with setup guide

Tests: 10 unit + 2 config integration + 1 API integration test
@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps bot commented Mar 23, 2026

Greptile Summary

This PR adds MiniMax as a first-class LLM provider by extending get_routing_for_model in plexe/config.py with auto-routing for the minimax/ prefix, and adding model ID rewriting (minimax/openai/) plus temperature clamping in PlexeLiteLLMModel.__init__. The integration slots cleanly into the existing per-agent routing pipeline — no agent code changes are required.

  • Routing logic is correct: explicit routing_config.models mappings take priority, MiniMax auto-routing is second, and the default fallback is preserved for all other providers.
  • Temperature clamping at init time is a reasonable safeguard; callers that override temperature per-call (via generate/chat kwargs) would bypass it, but that code path is not used by any current agent.
  • MINIMAX_MODELS is defined but never consumed by any production code — it should either be wired in (e.g. for model ID validation) or removed.
  • Warning message in get_routing_for_model says "Using default routing" but for minimax/ models with a broken explicit mapping it actually falls through to MiniMax auto-routing, not the default config.
  • Imports inside test functions (from plexe.utils.litellm_wrapper import LiteLLMModel) appear in 10 test methods in tests/unit/utils/test_litellm_wrapper.py, violating the project style guide ("NEVER inside functions").

Confidence Score: 4/5

  • Safe to merge after fixing the misleading warning message and the style-guide import violations in tests.
  • The core routing and rewriting logic is correct and well-tested. Three non-blocking issues remain: a misleading log message for an edge-case (bad provider mapping on a minimax model), unused MINIMAX_MODELS dead code, and style-guide import violations in test files. None of these affect runtime correctness for the primary user path.
  • plexe/config.py (warning message) and tests/unit/utils/test_litellm_wrapper.py (imports inside functions).

Important Files Changed

Filename Overview
plexe/config.py Adds MiniMax routing constants and auto-routing logic in get_routing_for_model; one misleading warning message and one unused MINIMAX_MODELS constant found.
plexe/utils/litellm_wrapper.py Adds minimax/openai/ model ID rewriting and temperature clamping in PlexeLiteLLMModel.__init__; logic is correct and integrates cleanly with the existing routing pipeline.
tests/unit/utils/test_litellm_wrapper.py Good coverage of model ID rewriting and temperature clamping; violates the project style guide by importing LiteLLMModel inside 10 test method bodies instead of at module top level.
tests/unit/test_config.py Thorough tests for auto-routing, explicit mapping override, no-key edge case, and YAML/env loading; no issues found.
tests/unit/test_minimax_integration.py Integration tests for YAML roundtrip, mixed-provider config, and live API completion (correctly guarded by pytest.skip when MINIMAX_API_KEY is absent); no issues found.
README.md Adds MiniMax setup guide and API-key export snippet; documentation is accurate and well-placed.
config.yaml.template Adds commented MiniMax config example with all four model variants and a note about litellm_drop_params; no issues found.
Prompt To Fix All With AI
This is a comment left during a code review.
Path: tests/unit/utils/test_litellm_wrapper.py
Line: 22-25

Comment:
**Imports inside test functions violate style guide**

The project's style guide (`CLAUDE.md`) states: "Imports: ALWAYS at top level in order: stdlib, third-party, local; **NEVER inside functions**." The `from plexe.utils.litellm_wrapper import LiteLLMModel` import appears inside 10 separate test methods instead of at the module top level.

Move the import to the top of the file:

```suggestion
from unittest.mock import patch, MagicMock

import pytest

from plexe.utils.litellm_wrapper import LiteLLMModel, PlexeLiteLLMModel
```

Then remove the repeated `from plexe.utils.litellm_wrapper import LiteLLMModel` lines inside each test method body.

**Context Used:** CLAUDE.md ([source](https://app.greptile.com/review/custom-context?memory=72154d9b-42a4-4734-9db8-1821c15d8b84))

How can I resolve this? If you propose a fix, please make it concise.

---

This is a comment left during a code review.
Path: plexe/config.py
Line: 178-184

Comment:
**`MINIMAX_MODELS` is dead code — never consumed by production code**

`MINIMAX_MODELS` is defined and exported but is only referenced in the test `test_minimax_models_constant`, which just asserts the constant has certain keys. No production code path (routing, validation, context-window capping, etc.) reads from it. Either wire it into `get_routing_for_model` / `PlexeLiteLLMModel` to serve a real purpose (e.g. rejecting unknown model IDs or surfacing context-window metadata), or remove it to keep the codebase lean per the project's "prefer deleting code over adding code" principle.

How can I resolve this? If you propose a fix, please make it concise.

---

This is a comment left during a code review.
Path: plexe/config.py
Line: 551-554

Comment:
**Misleading warning message when an explicit mapping references a non-existent provider**

When `model_id` is a `minimax/` model AND its explicit provider mapping resolves to a non-existent provider, the warning says **"Using default routing"** but execution then falls through to the MiniMax auto-routing branch — not the `config.default` path. The log message will mislead anyone debugging the routing decision.

```suggestion
            logging.getLogger(__name__).warning(
                f"Model '{model_id}' references non-existent provider '{provider_name}'. "
                "Falling through to next routing step."
            )
```

How can I resolve this? If you propose a fix, please make it concise.

Reviews (1): Last reviewed commit: "feat: add MiniMax as first-class LLM pro..." | Re-trigger Greptile

Comment on lines +22 to +25
model = PlexeLiteLLMModel(model_id="minimax/MiniMax-M2.7", temperature=0.2)
# The super().__init__ was patched, so check the call args
from plexe.utils.litellm_wrapper import LiteLLMModel

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Imports inside test functions violate style guide

The project's style guide (CLAUDE.md) states: "Imports: ALWAYS at top level in order: stdlib, third-party, local; NEVER inside functions." The from plexe.utils.litellm_wrapper import LiteLLMModel import appears inside 10 separate test methods instead of at the module top level.

Move the import to the top of the file:

Suggested change
model = PlexeLiteLLMModel(model_id="minimax/MiniMax-M2.7", temperature=0.2)
# The super().__init__ was patched, so check the call args
from plexe.utils.litellm_wrapper import LiteLLMModel
from unittest.mock import patch, MagicMock
import pytest
from plexe.utils.litellm_wrapper import LiteLLMModel, PlexeLiteLLMModel

Then remove the repeated from plexe.utils.litellm_wrapper import LiteLLMModel lines inside each test method body.

Context Used: CLAUDE.md (source)

Prompt To Fix With AI
This is a comment left during a code review.
Path: tests/unit/utils/test_litellm_wrapper.py
Line: 22-25

Comment:
**Imports inside test functions violate style guide**

The project's style guide (`CLAUDE.md`) states: "Imports: ALWAYS at top level in order: stdlib, third-party, local; **NEVER inside functions**." The `from plexe.utils.litellm_wrapper import LiteLLMModel` import appears inside 10 separate test methods instead of at the module top level.

Move the import to the top of the file:

```suggestion
from unittest.mock import patch, MagicMock

import pytest

from plexe.utils.litellm_wrapper import LiteLLMModel, PlexeLiteLLMModel
```

Then remove the repeated `from plexe.utils.litellm_wrapper import LiteLLMModel` lines inside each test method body.

**Context Used:** CLAUDE.md ([source](https://app.greptile.com/review/custom-context?memory=72154d9b-42a4-4734-9db8-1821c15d8b84))

How can I resolve this? If you propose a fix, please make it concise.

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

Comment on lines +178 to +184
MINIMAX_MODELS = {
"MiniMax-M2.7": {"context_window": 1_000_000},
"MiniMax-M2.7-highspeed": {"context_window": 1_000_000},
"MiniMax-M2.5": {"context_window": 204_000},
"MiniMax-M2.5-highspeed": {"context_window": 204_000},
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 MINIMAX_MODELS is dead code — never consumed by production code

MINIMAX_MODELS is defined and exported but is only referenced in the test test_minimax_models_constant, which just asserts the constant has certain keys. No production code path (routing, validation, context-window capping, etc.) reads from it. Either wire it into get_routing_for_model / PlexeLiteLLMModel to serve a real purpose (e.g. rejecting unknown model IDs or surfacing context-window metadata), or remove it to keep the codebase lean per the project's "prefer deleting code over adding code" principle.

Prompt To Fix With AI
This is a comment left during a code review.
Path: plexe/config.py
Line: 178-184

Comment:
**`MINIMAX_MODELS` is dead code — never consumed by production code**

`MINIMAX_MODELS` is defined and exported but is only referenced in the test `test_minimax_models_constant`, which just asserts the constant has certain keys. No production code path (routing, validation, context-window capping, etc.) reads from it. Either wire it into `get_routing_for_model` / `PlexeLiteLLMModel` to serve a real purpose (e.g. rejecting unknown model IDs or surfacing context-window metadata), or remove it to keep the codebase lean per the project's "prefer deleting code over adding code" principle.

How can I resolve this? If you propose a fix, please make it concise.

Comment on lines 551 to 554
if provider_name not in config.providers:
# This should have been caught by validation, but handle gracefully
logging.getLogger(__name__).warning(
f"Model '{model_id}' references non-existent provider '{provider_name}'. Using default routing."
)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Misleading warning message when an explicit mapping references a non-existent provider

When model_id is a minimax/ model AND its explicit provider mapping resolves to a non-existent provider, the warning says "Using default routing" but execution then falls through to the MiniMax auto-routing branch — not the config.default path. The log message will mislead anyone debugging the routing decision.

Suggested change
if provider_name not in config.providers:
# This should have been caught by validation, but handle gracefully
logging.getLogger(__name__).warning(
f"Model '{model_id}' references non-existent provider '{provider_name}'. Using default routing."
)
logging.getLogger(__name__).warning(
f"Model '{model_id}' references non-existent provider '{provider_name}'. "
"Falling through to next routing step."
)
Prompt To Fix With AI
This is a comment left during a code review.
Path: plexe/config.py
Line: 551-554

Comment:
**Misleading warning message when an explicit mapping references a non-existent provider**

When `model_id` is a `minimax/` model AND its explicit provider mapping resolves to a non-existent provider, the warning says **"Using default routing"** but execution then falls through to the MiniMax auto-routing branch — not the `config.default` path. The log message will mislead anyone debugging the routing decision.

```suggestion
            logging.getLogger(__name__).warning(
                f"Model '{model_id}' references non-existent provider '{provider_name}'. "
                "Falling through to next routing step."
            )
```

How can I resolve this? If you propose a fix, please make it concise.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant